﻿namespace VisualPhysics.Scene.Core.Tests

open System
open System.Drawing
open VisualPhysics.Scene.Core
open VisualPhysics.Scene.Core.Operators
open VisualPhysics.Scene.Core.Tests.Utils
open NUnit.Framework
open FsUnit

type [<TestFixture>] ``BallObject tests``() =

    [<Test>]
    [<Category("BallObject.ValueMembers")>]
    member t.``Checking the Tag member of a BallObject``() =
        let ``The ball we are testing`` = BallObject(pol (14.1<cm>, 31.41<cm>), 1.0<cm>, 1.0<gram>)
        let ``The ball we are testing as Object`` = ``The ball we are testing``.Object()
        ``The ball we are testing as Object``.Tag |> should equal Ball

    [<Test>]
    [<Category("BallObject.ValueMembers")>]
    member t.``Checking the Position member of a BallObject``() =
        let ``The ball we are testing`` = BallObject(pol (14.1<cm>, 31.41<cm>), 1.0<cm>, 1.0<gram>)
        let ``The ball we are testing as Object`` = ``The ball we are testing``.Object()
        ``The ball we are testing as Object``.CarPosition
        |> equalTuples (14.1<cm>, 31.41<cm>)
        |> should equal (14.1<cm>, 31.41<cm>)

    [<Test>]
    [<Category("BallObject.ValueMembers")>]
    member t.``Checking the Velocity member of a BallObject``() =
        let ``The ball we are testing`` = BallObject(pol (14.1<cm>, 31.41<cm>), 1.0<cm>, 1.0<gram>)
        let ``The ball we are testing as Object`` = ``The ball we are testing``.Object()
        ``The ball we are testing as Object``.Velocity |> should equal (0.0<cm / s>, 0.0)

    [<Test>]
    [<Category("BallObject.ValueMembers")>]
    member t.``Checking the Color member of a BallObject``() =
        let ``The ball we are testing`` = BallObject(pol (14.1<cm>, 31.41<cm>), 1.0<cm>, 1.0<gram>)
        let ``The ball we are testing as Object`` = ``The ball we are testing``.Object()
        ``The ball we are testing as Object``.Color |> should equal Brushes.Black

    [<Test>]
    [<Category("BallObject.ValueMembers")>]
    member t.``Checking the Mass member of a BallObject``() =
        let ``The ball we are testing`` = BallObject(pol (14.1<cm>, 31.41<cm>), 1.0<cm>, 1.0<gram>)
        let ``The ball we are testing as Object`` = ``The ball we are testing``.Object()
        ``The ball we are testing as Object``.Mass |> should equal 1.0<gram>

    [<Test>]
    [<Category("BallObject.ValueMembers")>]
    member t.``Checking the Rectangle member of a BallObject``() =
        let ``The ball we are testing`` = BallObject(pol (14.1<cm>, 31.41<cm>), 1.0<cm>, 1.0<gram>)
        ``The ball we are testing``.Rectangle |> should equal (RectangleF(PointF(13.1f, 30.41f), SizeF(2.0f, 2.0f)))

    [<Test>]
    [<Category("BallObject.ValueMembers")>]
    member t.``Checking the Radius member of a BallObject``() =
        let ``The ball we are testing`` = BallObject(pol (14.1<cm>, 31.41<cm>), 1.0<cm>, 1.0<gram>)
        ``The ball we are testing``.Radius |> should equal 1.0<cm>

    [<Test>]
    [<Category("BallObject.Setters")>]
    member t.``Changing the position of a BallObject as Object``() =
        let ``The ball we are testing`` = BallObject(pol (14.1<cm>, 31.41<cm>), 1.0<cm>, 1.0<gram>)
        let ``The ball we are testing as Object`` = ``The ball we are testing``.Object()
        let ``The new ball`` = ``The ball we are testing as Object``.SetCarPosition (4.0<cm>, 6.0<cm>)
        ``The new ball``.CarPosition |> should equal (4.0<cm>, 6.0<cm>)

    [<Test>]
    [<Category("BallObject.Setters")>]
    member t.``Changing the color of a BallObject as Object``() =
        let ``The ball we are testing`` = BallObject(pol (14.1<cm>, 31.41<cm>), 1.0<cm>, 1.0<gram>)
        let ``The ball we are testing as Object`` = ``The ball we are testing``.Object()
        let ``The new ball`` = ``The ball we are testing as Object``.SetColor Brushes.Orange
        ``The new ball``.Color |> should equal Brushes.Orange